<!--
 * @Description: 
 * @Author: Leequik
 * @Date: 2025-06-15 15:04:34
 * @LastEditTime: 2025-07-07 11:27:51
 * @LastEditors: Leequik
-->
<template>
    <div class="father">
        <h3>父组件</h3>
        <h5 v-show="computer">小儿子给的电脑：{{ computer}}</h5>
        <Child1 />
        <Child2 />
    </div>
</template>
<script lang="js" setup>
    import Child1 from './Child1.vue';
    import Child2 from './Child2.vue';

    import { ref } from 'vue';
    import emitter from '../../utils/emitter.ts';
    
    let computer = ref('');
    
    emitter.on('send-com', (data) => {
    console.log('子组件2接收到1的数据：', data);
    computer.value = data;
});
    
    
</script>
<style scoped>
    .father{
        background-color: #1DB561;
        padding: 20px;
        border-radius: 10px;
    }
</style>